package com.solo.system.mapper;

import com.mybatisflex.core.query.QueryChain;
import com.solo.common.core.base.mapper.BasicMapper;
import com.solo.system.api.entity.SysConfig;
import org.apache.ibatis.annotations.Mapper;

import static com.solo.system.api.entity.table.SysConfigTableDef.SysConfigTable;

/**
 * 系统配置 Mapper
 * @author 十一
 * @since 2023-10-18 16:33
 * 人生若只如初见，何事秋风悲画扇
 **/
@Mapper
public interface SysConfigMapper extends BasicMapper<SysConfig> {

    /**
     * 按键查询系统配置信息
     * @param key 钥匙
     * @return {@link SysConfig }
     */
    default SysConfig selectByKey(String key) {
        return QueryChain.of(this)
                .where(SysConfigTable.Key.eq(key))
                .one();
    }

}
